\(\int \frac {\sec ^3(c+d x)}{(a \cos (c+d x)+i a \sin (c+d x))^2} \, dx\) [171]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 31, antiderivative size = 56 \[ \int \frac {\sec ^3(c+d x)}{(a \cos (c+d x)+i a \sin (c+d x))^2} \, dx=\frac {3 \text {arctanh}(\sin (c+d x))}{2 a^2 d}-\frac {2 i \sec (c+d x)}{a^2 d}-\frac {\sec (c+d x) \tan (c+d x)}{2 a^2 d} \]

[Out]

3/2*arctanh(sin(d*x+c))/a^2/d-2*I*sec(d*x+c)/a^2/d-1/2*sec(d*x+c)*tan(d*x+c)/a^2/d

Rubi [A] (verified)

Time = 0.16 (sec) , antiderivative size = 56, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.194, Rules used = {3171, 3169, 3855, 2686, 8, 2691} \[ \int \frac {\sec ^3(c+d x)}{(a \cos (c+d x)+i a \sin (c+d x))^2} \, dx=\frac {3 \text {arctanh}(\sin (c+d x))}{2 a^2 d}-\frac {2 i \sec (c+d x)}{a^2 d}-\frac {\tan (c+d x) \sec (c+d x)}{2 a^2 d} \]

[In]

Int[Sec[c + d*x]^3/(a*Cos[c + d*x] + I*a*Sin[c + d*x])^2,x]

[Out]

(3*ArcTanh[Sin[c + d*x]])/(2*a^2*d) - ((2*I)*Sec[c + d*x])/(a^2*d) - (Sec[c + d*x]*Tan[c + d*x])/(2*a^2*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2686

Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a/f, Subst[
Int[(a*x)^(m - 1)*(-1 + x^2)^((n - 1)/2), x], x, Sec[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && IntegerQ[(n -
1)/2] &&  !(IntegerQ[m/2] && LtQ[0, m, n + 1])

Rule 2691

Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b*(a*Sec[e +
 f*x])^m*((b*Tan[e + f*x])^(n - 1)/(f*(m + n - 1))), x] - Dist[b^2*((n - 1)/(m + n - 1)), Int[(a*Sec[e + f*x])
^m*(b*Tan[e + f*x])^(n - 2), x], x] /; FreeQ[{a, b, e, f, m}, x] && GtQ[n, 1] && NeQ[m + n - 1, 0] && Integers
Q[2*m, 2*n]

Rule 3169

Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_.), x_Sym
bol] :> Int[ExpandTrig[cos[c + d*x]^m*(a*cos[c + d*x] + b*sin[c + d*x])^n, x], x] /; FreeQ[{a, b, c, d}, x] &&
 IntegerQ[m] && IGtQ[n, 0]

Rule 3171

Int[cos[(c_.) + (d_.)*(x_)]^(m_.)*(cos[(c_.) + (d_.)*(x_)]*(a_.) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symb
ol] :> Dist[a^n*b^n, Int[Cos[c + d*x]^m/(b*Cos[c + d*x] + a*Sin[c + d*x])^n, x], x] /; FreeQ[{a, b, c, d, m},
x] && EqQ[a^2 + b^2, 0] && ILtQ[n, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = -\frac {\int \sec ^3(c+d x) (i a \cos (c+d x)+a \sin (c+d x))^2 \, dx}{a^4} \\ & = -\frac {\int \left (-a^2 \sec (c+d x)+2 i a^2 \sec (c+d x) \tan (c+d x)+a^2 \sec (c+d x) \tan ^2(c+d x)\right ) \, dx}{a^4} \\ & = -\frac {(2 i) \int \sec (c+d x) \tan (c+d x) \, dx}{a^2}+\frac {\int \sec (c+d x) \, dx}{a^2}-\frac {\int \sec (c+d x) \tan ^2(c+d x) \, dx}{a^2} \\ & = \frac {\text {arctanh}(\sin (c+d x))}{a^2 d}-\frac {\sec (c+d x) \tan (c+d x)}{2 a^2 d}+\frac {\int \sec (c+d x) \, dx}{2 a^2}-\frac {(2 i) \text {Subst}(\int 1 \, dx,x,\sec (c+d x))}{a^2 d} \\ & = \frac {3 \text {arctanh}(\sin (c+d x))}{2 a^2 d}-\frac {2 i \sec (c+d x)}{a^2 d}-\frac {\sec (c+d x) \tan (c+d x)}{2 a^2 d} \\ \end{align*}

Mathematica [B] (verified)

Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(146\) vs. \(2(56)=112\).

Time = 0.55 (sec) , antiderivative size = 146, normalized size of antiderivative = 2.61 \[ \int \frac {\sec ^3(c+d x)}{(a \cos (c+d x)+i a \sin (c+d x))^2} \, dx=-\frac {\sec ^2(c+d x) \left (8 i \cos (c+d x)+3 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+3 \cos (2 (c+d x)) \left (\log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )\right )-3 \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+2 \sin (c+d x)\right )}{4 a^2 d} \]

[In]

Integrate[Sec[c + d*x]^3/(a*Cos[c + d*x] + I*a*Sin[c + d*x])^2,x]

[Out]

-1/4*(Sec[c + d*x]^2*((8*I)*Cos[c + d*x] + 3*Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] + 3*Cos[2*(c + d*x)]*(Lo
g[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] - Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]]) - 3*Log[Cos[(c + d*x)/2] +
Sin[(c + d*x)/2]] + 2*Sin[c + d*x]))/(a^2*d)

Maple [A] (verified)

Time = 0.70 (sec) , antiderivative size = 89, normalized size of antiderivative = 1.59

method result size
risch \(-\frac {i \left (3 \,{\mathrm e}^{3 i \left (d x +c \right )}+5 \,{\mathrm e}^{i \left (d x +c \right )}\right )}{d \,a^{2} \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}+\frac {3 \ln \left (i+{\mathrm e}^{i \left (d x +c \right )}\right )}{2 a^{2} d}-\frac {3 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{2 a^{2} d}\) \(89\)
derivativedivides \(\frac {\frac {2 \left (-\frac {1}{4}-i\right )}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}+\frac {1}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}+\frac {3 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2}+\frac {2 \left (-\frac {1}{4}+i\right )}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}-\frac {1}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}-\frac {3 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2}}{a^{2} d}\) \(102\)
default \(\frac {\frac {2 \left (-\frac {1}{4}-i\right )}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1}+\frac {1}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2}}+\frac {3 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2}+\frac {2 \left (-\frac {1}{4}+i\right )}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1}-\frac {1}{2 \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}-\frac {3 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2}}{a^{2} d}\) \(102\)
norman \(\frac {-\frac {4 i}{a d}-\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{a d}-\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{a d}+\frac {4 i \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{a d}}{\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2} \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )^{2} a}-\frac {3 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 a^{2} d}+\frac {3 \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 a^{2} d}\) \(138\)

[In]

int(sec(d*x+c)^3/(cos(d*x+c)*a+I*a*sin(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

-I/d/a^2/(exp(2*I*(d*x+c))+1)^2*(3*exp(3*I*(d*x+c))+5*exp(I*(d*x+c)))+3/2/a^2/d*ln(I+exp(I*(d*x+c)))-3/2/a^2/d
*ln(exp(I*(d*x+c))-I)

Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 134 vs. \(2 (50) = 100\).

Time = 0.27 (sec) , antiderivative size = 134, normalized size of antiderivative = 2.39 \[ \int \frac {\sec ^3(c+d x)}{(a \cos (c+d x)+i a \sin (c+d x))^2} \, dx=\frac {3 \, {\left (e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )} \log \left (e^{\left (i \, d x + i \, c\right )} + i\right ) - 3 \, {\left (e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )} \log \left (e^{\left (i \, d x + i \, c\right )} - i\right ) - 6 i \, e^{\left (3 i \, d x + 3 i \, c\right )} - 10 i \, e^{\left (i \, d x + i \, c\right )}}{2 \, {\left (a^{2} d e^{\left (4 i \, d x + 4 i \, c\right )} + 2 \, a^{2} d e^{\left (2 i \, d x + 2 i \, c\right )} + a^{2} d\right )}} \]

[In]

integrate(sec(d*x+c)^3/(a*cos(d*x+c)+I*a*sin(d*x+c))^2,x, algorithm="fricas")

[Out]

1/2*(3*(e^(4*I*d*x + 4*I*c) + 2*e^(2*I*d*x + 2*I*c) + 1)*log(e^(I*d*x + I*c) + I) - 3*(e^(4*I*d*x + 4*I*c) + 2
*e^(2*I*d*x + 2*I*c) + 1)*log(e^(I*d*x + I*c) - I) - 6*I*e^(3*I*d*x + 3*I*c) - 10*I*e^(I*d*x + I*c))/(a^2*d*e^
(4*I*d*x + 4*I*c) + 2*a^2*d*e^(2*I*d*x + 2*I*c) + a^2*d)

Sympy [F]

\[ \int \frac {\sec ^3(c+d x)}{(a \cos (c+d x)+i a \sin (c+d x))^2} \, dx=\frac {\int \frac {\sec ^{3}{\left (c + d x \right )}}{- \sin ^{2}{\left (c + d x \right )} + 2 i \sin {\left (c + d x \right )} \cos {\left (c + d x \right )} + \cos ^{2}{\left (c + d x \right )}}\, dx}{a^{2}} \]

[In]

integrate(sec(d*x+c)**3/(a*cos(d*x+c)+I*a*sin(d*x+c))**2,x)

[Out]

Integral(sec(c + d*x)**3/(-sin(c + d*x)**2 + 2*I*sin(c + d*x)*cos(c + d*x) + cos(c + d*x)**2), x)/a**2

Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 167 vs. \(2 (50) = 100\).

Time = 0.23 (sec) , antiderivative size = 167, normalized size of antiderivative = 2.98 \[ \int \frac {\sec ^3(c+d x)}{(a \cos (c+d x)+i a \sin (c+d x))^2} \, dx=-\frac {\frac {2 \, {\left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - \frac {4 i \, \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {\sin \left (d x + c\right )^{3}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{3}} + 4 i\right )}}{a^{2} - \frac {2 \, a^{2} \sin \left (d x + c\right )^{2}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{2}} + \frac {a^{2} \sin \left (d x + c\right )^{4}}{{\left (\cos \left (d x + c\right ) + 1\right )}^{4}}} - \frac {3 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} + 1\right )}{a^{2}} + \frac {3 \, \log \left (\frac {\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1} - 1\right )}{a^{2}}}{2 \, d} \]

[In]

integrate(sec(d*x+c)^3/(a*cos(d*x+c)+I*a*sin(d*x+c))^2,x, algorithm="maxima")

[Out]

-1/2*(2*(sin(d*x + c)/(cos(d*x + c) + 1) - 4*I*sin(d*x + c)^2/(cos(d*x + c) + 1)^2 + sin(d*x + c)^3/(cos(d*x +
 c) + 1)^3 + 4*I)/(a^2 - 2*a^2*sin(d*x + c)^2/(cos(d*x + c) + 1)^2 + a^2*sin(d*x + c)^4/(cos(d*x + c) + 1)^4)
- 3*log(sin(d*x + c)/(cos(d*x + c) + 1) + 1)/a^2 + 3*log(sin(d*x + c)/(cos(d*x + c) + 1) - 1)/a^2)/d

Giac [A] (verification not implemented)

none

Time = 0.32 (sec) , antiderivative size = 95, normalized size of antiderivative = 1.70 \[ \int \frac {\sec ^3(c+d x)}{(a \cos (c+d x)+i a \sin (c+d x))^2} \, dx=\frac {\frac {3 \, \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1\right )}{a^{2}} - \frac {3 \, \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1\right )}{a^{2}} - \frac {2 \, {\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 i \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 4 i\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{2} a^{2}}}{2 \, d} \]

[In]

integrate(sec(d*x+c)^3/(a*cos(d*x+c)+I*a*sin(d*x+c))^2,x, algorithm="giac")

[Out]

1/2*(3*log(tan(1/2*d*x + 1/2*c) + 1)/a^2 - 3*log(tan(1/2*d*x + 1/2*c) - 1)/a^2 - 2*(tan(1/2*d*x + 1/2*c)^3 - 4
*I*tan(1/2*d*x + 1/2*c)^2 + tan(1/2*d*x + 1/2*c) + 4*I)/((tan(1/2*d*x + 1/2*c)^2 - 1)^2*a^2))/d

Mupad [B] (verification not implemented)

Time = 23.16 (sec) , antiderivative size = 104, normalized size of antiderivative = 1.86 \[ \int \frac {\sec ^3(c+d x)}{(a \cos (c+d x)+i a \sin (c+d x))^2} \, dx=\frac {3\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{a^2\,d}-\frac {\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3}{a^2}+\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{a^2}-\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,4{}\mathrm {i}}{a^2}+\frac {4{}\mathrm {i}}{a^2}}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4-2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )} \]

[In]

int(1/(cos(c + d*x)^3*(a*cos(c + d*x) + a*sin(c + d*x)*1i)^2),x)

[Out]

(3*atanh(tan(c/2 + (d*x)/2)))/(a^2*d) - (tan(c/2 + (d*x)/2)^3/a^2 - (tan(c/2 + (d*x)/2)^2*4i)/a^2 + 4i/a^2 + t
an(c/2 + (d*x)/2)/a^2)/(d*(tan(c/2 + (d*x)/2)^4 - 2*tan(c/2 + (d*x)/2)^2 + 1))